/*
interface{} 空接口，万能类型
联想：void* Object等
https://www.bilibili.com/video/BV1gf4y1r79E/?p=21&spm_id_from=pageDriver&vd_source=8bd7b24b38e3e12c558d839b352b32f4
*/
package main

import "fmt"

// interface {}
func myFunc(arg interface{}) {
	fmt.Println("myFunc is called...")
	fmt.Println(arg)

	// 区分实际传来的数据类型：类型断言
	_, ok := arg.(string)
	if !ok {
		fmt.Println("arg is not string type")
	}

}

type Book struct {
	auth string
}

func main() {
	fmt.Println("interface{} ")
	// 1. Book
	book := Book{"Golang"}
	myFunc(book)
	// 2. int
	myFunc(100)
	// 3. string
	myFunc("interface {}")
}
